/*
 * @(#) BaseDispatchAction.java  1.0  2004-3-24
 *
 * Copyright 2003 by LongTop Corporation.
 * 2669 XieTu Road, ShangHai, PRC 200030
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * LongTop Corporation ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with LongTop.
 */

package com.cnc.bas.web;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.actions.DispatchAction;
import com.cnc.bas.util.SpringBeanFactory;


/**
 * @author Du bf
 * @version 1.0  2004-3-24
 */
public class BasDispatchAction extends DispatchAction {
   
    protected ServletContext context;

    public void setServlet(ActionServlet actionServlet) {
        super.setServlet(actionServlet);
        context = actionServlet.getServletContext();       
    }

    /**
     * ��õ��ýӿ�
     *
     * @param beanName ������
     * @return �ӿ�
     */
    protected Object getBean(String beanName) {
        return SpringBeanFactory.getBean(beanName);
    }
    
    protected void saveDirectlyError(HttpServletRequest request, String message) {
		ActionErrors errors = new ActionErrors();
		//errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(DIRECTLY_MESSAGE_KEY, message));
		errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(message));
		this.saveErrors(request, errors);
	}
	
}
